home *** CD-ROM | disk | FTP | other *** search
/ Galaxy of Games (Gold) / goggold.iso / IE5 / U.S. English / IEW2K_2.CAB / mshtmler.dll / HTML / INSIMAGE.DLG < prev    next >
Text File  |  2000-06-02  |  12KB  |  371 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
  2. <HTML id=dlgImage STYLE="font-family: MS Shell Dlg; font-size: 8pt;
  3. width: 40.1em; height: 18em">
  4. <HEAD>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <TITLE>
  7. Picture
  8. </TITLE>
  9. <SCRIPT defer>
  10. function callHelp(elm)
  11. {
  12. if (null != elm.helpid)
  13. {
  14.  window.showHelp(elm.helpfile, "" + parseInt(elm.helpid),
  15.   "popup");
  16. }
  17. else
  18. {
  19.  if ("BODY" != elm.tagName)
  20.  {
  21.   callHelp(elm.parentElement);
  22.  }
  23. }
  24. function btnCancelClick()
  25. {
  26. window.close();
  27. function getTextRange(elm)
  28. {
  29. var r = elm.parentTextEdit.createTextRange();
  30. r.moveToElementText(elm);
  31. return r;
  32. function mouseClick()
  33. {
  34. if (window.event.srcElement.id.substring(0,3)
  35.  == "txt")
  36. {
  37.  return;
  38. }
  39. if (window.event.button == 2)
  40. {
  41.  callHelp(window.event.srcElement);
  42. }
  43. function txtDefaultESC()
  44. {
  45. if (event.keyCode == 27)
  46. {
  47.  window.close();
  48.  return;
  49. }
  50. window.onerror = HandleError
  51. var L_Dialog_ErrorMessage = "An error has occurred in this dialog.";
  52. var L_ErrorNumber_Text = "Error: ";
  53. function HandleError(message, url, line)
  54. {
  55. var str = L_Dialog_ErrorMessage + "\n\n" 
  56.  + L_ErrorNumber_Text + line + "\n"
  57.  + message;
  58. alert (str);
  59. window.close();
  60. return true;
  61. }
  62. function setOKState(fEvent) { if (fEvent && (event.propertyName != "value")) { return; } if (("" == txtFileName.value) == g_fOKEnabled) { btnOK.disabled = g_fOKEnabled; g_fOKEnabled = !g_fOKEnabled; } } var g_fOKEnabled = false;
  63. function btnBrowseClick()
  64. {
  65. var L_Picture_DIALOG_Title_DialogTitle = "Picture";
  66. var L_Picture_DIALOG_FileTypes_Text = "GIF and JPEG (*.gif, *.jpg)|*.gif;*.jpg|Bitmap (*.bmp)|*.bmp|Windows Metafile (*.wmf)|*.wmf|XBM (*.xbm)|*.xbm|ART (*.art)|*.art|All files (*.*)|*.*|";
  67. var strFileName;
  68. strFileName = dialogHelper.openfiledlg("", "",
  69.  L_Picture_DIALOG_FileTypes_Text,L_Picture_DIALOG_Title_DialogTitle);
  70. if ("" != strFileName)
  71. {
  72.  txtFileName.value = strFileName;
  73. }
  74. setOKState(false);
  75. function getProtocolFromURL(strURL)
  76. {
  77. var index;
  78. return strURL.substring(0, strURL.indexOf(":") + 1);
  79. function bdyLoad()
  80. {
  81. var elmSelectedImage;  
  82. var htmlSelectionControl = "Control";
  83. var globalDoc = window.dialogArguments;
  84. var grngMaster = globalDoc.selection.createRange();
  85. txtFileName.onfocus = new Function("txtFileName.select()");
  86. txtFileName.onkeypress = new Function("txtDefaultESC()");
  87. txtAltText.onfocus = new Function("txtAltText.select()");
  88. txtAltText.onkeypress = new Function("txtDefaultESC()");
  89. txtHorizontal.onfocus = new Function("txtHorizontal.select()");
  90. txtHorizontal.onkeypress = new Function("txtDefaultESC()");
  91. txtBorder.onfocus = new Function("txtBorder.select()");
  92. txtBorder.onkeypress = new Function("txtDefaultESC()");
  93. txtVertical.onfocus = new Function("txtVertical.select()");
  94. txtVertical.onkeypress = new Function("txtDefaultESC()");
  95. btnBrowse.onclick = new Function("btnBrowseClick()");
  96. btnOK.onclick = new Function("btnOKClick()");
  97. btnCancel.onclick = new Function("btnCancelClick()");
  98. document.onhelp  = new Function("callHelp(window.event.srcElement)");
  99. document.onmouseup = new Function("mouseClick()");
  100. txtFileName.onpropertychange = new Function("setOKState(true)");
  101. txtFileName.fImageLoaded = false; 
  102. txtFileName.intImageWidth = 0; 
  103. txtFileName.intImageHeight = 0; 
  104. if (globalDoc.selection.type == htmlSelectionControl)  
  105. {
  106.  if (grngMaster.length == 1) 
  107.  {
  108.   elmSelectedImage = grngMaster.item(0);
  109.   if (elmSelectedImage.tagName == "IMG") 
  110.   {
  111.    txtFileName.fImageLoaded = true;
  112.    txtFileName.value = elmSelectedImage.src;
  113.    txtFileName.intImageHeight = elmSelectedImage.height;
  114.    txtFileName.intImageWidth = elmSelectedImage.width;
  115.    txtVertical.value = elmSelectedImage.vspace;
  116.    txtHorizontal.value = elmSelectedImage.hspace;
  117.    txtBorder.value = elmSelectedImage.border;
  118.    txtAltText.value = elmSelectedImage.alt;
  119.    selAlignment.value = elmSelectedImage.align;
  120.   }
  121.  }
  122. }
  123. setOKState(false);
  124. txtFileName.focus();
  125. function testTextValue(txtBox)
  126. {
  127. var val = parseInt(txtBox.value);
  128. if (isNaN(val) || val < 0 || val > 999)
  129. {
  130.  return false;
  131. }
  132. return true;
  133. function btnOKClick()
  134. {
  135. var elmImage;  
  136. var intAlignment; 
  137. var L_HorizontalNotNumber_ErrorMessage
  138.  = "Horizontal spacing must be a number between 0 and 999.";
  139. var L_VerticalNotNumber_ErrorMessage
  140.  = "Vertical spacing must be a number between 0 and 999.";
  141. var L_BoderNotNumber_ErrorMessage
  142.  = "Border thickness must be a number between 0 and 999.";
  143. var cmdInsertImage = "InsertImage";
  144. var cmdDelete = "Delete";
  145. var htmlSelectionControl = "Control";
  146. var globalDoc = window.dialogArguments;
  147. var grngMaster = globalDoc.selection.createRange();
  148. if ("" != txtHorizontal.value)
  149. {
  150.  if (!testTextValue(txtHorizontal))
  151.  {
  152.   alert(L_HorizontalNotNumber_ErrorMessage);
  153.   txtHorizontal.focus();
  154.   return;
  155.  }
  156. }
  157. if ("" != txtBorder.value)
  158. {
  159.  if (!testTextValue(txtBorder))
  160.  {
  161.   alert(L_BoderNotNumber_ErrorMessage);
  162.   txtBorder.focus();
  163.   return;
  164.  }
  165. }
  166. if ("" != txtVertical.value)
  167. {
  168.  if (!testTextValue(txtVertical))
  169.  {
  170.   alert(L_VerticalNotNumber_ErrorMessage);
  171.   txtVertical.focus();
  172.   return;
  173.  }
  174. }
  175. if (globalDoc.selection.type == htmlSelectionControl
  176.  && !txtFileName.fImageLoaded)
  177. {
  178.  grngMaster.execCommand(cmdDelete);
  179.  grngMaster = globalDoc.selection.createRange();
  180. }
  181. if (!txtFileName.fImageLoaded)
  182. {
  183.  grngMaster.execCommand(cmdInsertImage);
  184.  grngMaster.moveStart("character", -1);
  185.  elmImage = grngMaster.parentElement();
  186. }
  187. else 
  188. {
  189.  elmImage = grngMaster.item(0);
  190.  if (elmImage.src != txtFileName.value)
  191.  {
  192.   grngMaster.execCommand(cmdDelete);
  193.   grngMaster = globalDoc.selection.createRange();
  194.   grngMaster.execCommand(cmdInsertImage);
  195.   grngMaster.moveStart("character", -1);
  196.   elmImage = grngMaster.parentElement();
  197.   txtFileName.fImageLoaded = false;
  198.  }
  199.  grngMaster = getTextRange(elmImage);
  200. }
  201. if (txtFileName.fImageLoaded)
  202. {
  203.  elmImage.style.width = txtFileName.intImageWidth;
  204.  elmImage.style.height = txtFileName.intImageHeight;
  205. }
  206. if (txtFileName.value.length > 2040)
  207.  txtFileName.value = txtFileName.value.substring(0,2040);
  208. if ("" == getProtocolFromURL(txtFileName.value))
  209. {
  210.  elmImage.src = "file://" + txtFileName.value;
  211. }
  212. else
  213. {
  214.  elmImage.src = txtFileName.value;
  215. }
  216. if (txtHorizontal.value != "")
  217. {
  218.  elmImage.hspace = parseInt(txtHorizontal.value);
  219. }
  220. else
  221. {
  222.  elmImage.hspace = 0;
  223. }
  224. if (txtVertical.value != "")
  225. {
  226.  elmImage.vspace = parseInt(txtVertical.value);
  227. }
  228. else
  229. {
  230.  elmImage.vspace = 0;
  231. }
  232. elmImage.alt = txtAltText.value;
  233. if (txtBorder.value != "")
  234. {
  235.  elmImage.border = parseInt(txtBorder.value);
  236. }
  237. else
  238. {
  239.  elmImage.border = 0;
  240. }
  241. elmImage.align = selAlignment.value;
  242. grngMaster.collapse(false); 
  243. grngMaster.select();
  244. window.close();
  245. </SCRIPT>
  246. </HEAD>
  247. <BODY id=bdy onload="bdyLoad()" style="font-family: MS Shell Dlg; 
  248. font-size: 8pt; background: threedface; color: windowtext;" scroll=no>
  249. <OBJECT ID="dialogHelper" CLASSID="CLSID:3050f4e1-98b5-11cf-bb82-00aa00bdce0b"
  250.  HEIGHT=0 WIDTH=0 tabindex=-1>
  251. </OBJECT>
  252. <DIV id=divFileName style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  253. left: 0.98em; top: 1.2168em; width: 7em; height: 1.2168em; ">
  254. <LABEL id=lblFileName FOR=txtFileName tabIndex=-1
  255. helpid="35450" helpfile=msoe.hlp>
  256. <U>P</U>icture Source:
  257. </LABEL>
  258. </DIV>
  259. <INPUT ID=txtFileName type=text style="font-family: MS Shell Dlg; font-size: 8pt;
  260. position: absolute; left: 8.54em; top: 1.0647em; width: 13.58em;
  261. height: 2.1294em; " tabIndex=10 ACCESSKEY=p 
  262. helpid="35450" helpfile=msoe.hlp>
  263. <DIV id=divAltText style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  264. left: 0.98em; top: 4.1067em; width: 6.58em; height: 1.2168em; ">
  265. <LABEL id=lblAltText FOR=txtAltText tabIndex=-1
  266. helpid="35455" helpfile=msoe.hlp>
  267. Alternate <u>T</u>ext:
  268. </LABEL>
  269. </DIV>
  270. <INPUT type=text ID=txtAltText tabIndex=15 ACCESSKEY=t
  271. style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  272. left: 8.54em; top: 3.8025em; width: 21.5em; height: 2.1294em; "
  273. helpid="35455" helpfile=msoe.hlp>
  274. <BUTTON ID=btnBrowse style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  275. left: 22.96em; top: 1.0647em; width: 7em; height: 2.2em; "
  276. ACCESSKEY=r tabIndex=12 helpid="35462" helpfile=msoe.hlp>
  277. B<U>r</U>owse...
  278. </BUTTON>
  279. <FIELDSET id=fldLayout style="font-family: MS Shell Dlg; font-size: 8pt; 
  280. position: absolute; left: .9em; top: 7.1em; width: 17.08em; 
  281. height: 7.6em;">
  282. <LEGEND id=lgdLayout>
  283. Layout
  284. </LEGEND>
  285. </FIELDSET>
  286. <FIELDSET id=fldSpacing style="font-family: MS Shell Dlg; font-size: 8pt; 
  287. position: absolute; left: 18.9em; top: 7.1em; width: 11em; 
  288. height: 7.6em;">
  289. <LEGEND id=lgdSpacing>
  290. Spacing
  291. </LEGEND>
  292. </FIELDSET>
  293. <DIV id=divAlign style="font-family: MS Shell Dlg; font-size: 8pt; 
  294. position: absolute; left: 1.82em; top: 9.126em; width: 4.76em; 
  295. height: 1.2168em; ">
  296. <LABEL id=lblAlignment FOR=selAlignment tabIndex=-1 helpid="35465" 
  297. helpfile=msoe.hlp>
  298. <U>A</U>lignment:
  299. </LABEL>
  300. </DIV>
  301. <SELECT size=1 ID=selAlignment tabIndex=20 ACCESSKEY=a
  302. style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  303. left: 10.36em; top: 8.8218em; width: 6.72em; height: 1.2168em; "
  304. helpid="35465" helpfile=msoe.hlp>
  305. <OPTION id=optNotSet value="">    Not set </OPTION>
  306. <OPTION id=optLeft  value=left>    Left  </OPTION>
  307. <OPTION id=optRight  value=right>    Right  </OPTION>
  308. <OPTION id=optTexttop value=textTop>   Texttop </OPTION>
  309. <OPTION id=optAbsMiddle value=absMiddle>   Absmiddle </OPTION>
  310. <OPTION id=optBaseline value=baseline SELECTED> Baseline </OPTION>
  311. <OPTION id=optAbsBottom value=absBottom>   Absbottom </OPTION>
  312. <OPTION id=optBottom value=bottom>   Bottom  </OPTION>
  313. <OPTION id=optMiddle value=middle>   Middle  </OPTION>
  314. <OPTION id=optTop  value=top>    Top  </OPTION>
  315. </SELECT>
  316. <DIV id=divHoriz style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  317. left: 19.88em; top: 9.126em; width: 4.76em; height: 1.2168em; ">
  318. <LABEL id=lblHorizontal FOR=txtHorizontal tabIndex=-1 helpid="35475" 
  319. helpfile=msoe.hlp>
  320. <U>H</U>orizontal:
  321. </LABEL>
  322. </DIV>
  323. <INPUT ID=txtHorizontal style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  324. left: 24.92em; top: 8.8218em; width: 4.2em; height: 2.1294em; ime-mode: disabled;"
  325. type=text size=3 value="" tabIndex=25 ACCESSKEY=h
  326. helpid="35475" helpfile=msoe.hlp>
  327. <DIV id=divBorder style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  328. left: 1.82em; top: 12.0159em; width: 8.12em; height: 1.2168em; ">
  329. <LABEL id=lblBorder tabIndex=-1 FOR=txtBorder helpid="35470" 
  330. helpfile=msoe.hlp>
  331. <u>B</u>order Thickness:
  332. </LABEL>
  333. </DIV>
  334. <INPUT ID=txtBorder style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  335. left: 10.36em; top: 11.5596em; width: 6.72em; height: 2.1294em; ime-mode: disabled;"
  336. type=text size=3 value="" tabIndex=21 ACCESSKEY=b
  337. helpid="35470" helpfile=msoe.hlp>
  338. <DIV id=divVert style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  339. left: 19.88em; top: 12.0159em; width: 3.64em; height: 1.2168em; ">
  340. <LABEL id=lblVertical FOR=txtVertical tabIndex=-1 helpid="35480" 
  341. helpfile=msoe.hlp>
  342. <U>V</U>ertical:
  343. </LABEL>
  344. </DIV>
  345. <INPUT ID=txtVertical style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  346. left: 24.92em; top: 11.5596em; width: 4.2em; height: 2.1294em; ime-mode: disabled;"
  347. type=text size=3 value="" tabIndex=30 ACCESSKEY=v
  348. helpid="35480" helpfile=msoe.hlp>
  349. <BUTTON ID=btnOK style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  350. left: 31.36em; top: 1.0647em; width: 7em; height: 2.2em; " type=submit
  351. tabIndex=40 DISABLED=1 helpid="28443" helpfile="windows.hlp">
  352. OK
  353. </BUTTON>
  354. <BUTTON ID=btnCancel style="font-family: MS Shell Dlg; font-size: 8pt; position: absolute;
  355. left: 31.36em; top: 3.6504em; width: 7em; height: 2.2em; " type=reset
  356. tabIndex=45 helpid="28444" helpfile="windows.hlp">
  357. Cancel
  358. </BUTTON>
  359. </BODY>
  360. </HTML>
  361.